import pdb

from spd_launcher.config.config_loader import ConfigLoader
from spd_launcher.utils import PathUtils

# TODO 加载默认配置

class GlobalConfig(ConfigLoader):
    
    __CONFIG_DEFAULT_NAME = "config.json"
    
    def __init__(self, config_path=None):
        if not config_path or config_path.isspace():
            super().__init__(PathUtils.link_work_path(self.__CONFIG_DEFAULT_NAME))
        else:
            super().__init__(config_path) 
        
        # theards  
        self.theards_num = self._load_value("theards_num", except_type=int)

        # damain
        self.url_list_domain = self._load_value("domain", "url_list", except_type=list)
        self.current_url_index_domain = self._load_value("domain", "current_url_index", except_type=int)
        
        # apis
        self.realse_api = self._load_value("apis", "realse", except_type=str)
        self.versions_api = self._load_value("apis", "versions", except_type=str)
        self.version_pattern_api = self._load_value("apis", "version_pattern", except_type=str) 
        
        # paths
        self.temp_path = self._load_value("paths", "temp", except_type=str)
        self.root_path = self._load_value("paths", "root_path", except_type=str)
        self.versions_path = self._load_value("paths", "versions", except_type=str)
        
if __name__ == "__main__":
   pass 